package com.jlboot.app.admin.validate;

import com.jlboot.core.base.Validator;
import com.jfinal.core.Controller;

/**
 * Created by 51594 on 2022/9/19.
 */
public class SysDataValidator extends Validator {

    /**
     * validate
     *
     * @param controller
     */
    protected void validate(Controller controller) {
        validateRequiredString("data_key", "键值不能为空");
        validateRequiredString("data_title", "标题不能为空");
        validateRequiredString("data_name", "名称不能为空");
        validateNumber("sort", "显示顺序必须为数字");
        if (!isEdit()) validateFieldExit("sys_data", "data_key", "键值已存在");
    }
}
